package view;
import java.awt.BorderLayout;
import java.awt.Component;

import javax.swing.JFrame;

import model.State;


/**
 * Class to create the Login Frame.
 * @author Sarah George
 * @version Autumn 2012
 */
@SuppressWarnings("serial")
public class LoginFrame extends JFrame{
	
	/**
	 * Field to hold the current state of the system.
	 */
	private State my_state;
	
	/**
	 * Field to hold a choice panel.
	 */
	private ChoicePanel choicePanel;
	
	/**
	 * Constructor for a login frame.
	 * @param the_state the current state of the system.
	 */
	public LoginFrame(State the_state) {
		super("Login");
		my_state = the_state;
	}
	
	/**
	 * Method to start the frame.
	 */
	public void start() {
		final NamePanel namePanel = new NamePanel(my_state, this);
		final CenterPanel centerPanel = new CenterPanel(my_state);
		choicePanel = new ChoicePanel(my_state, this);
	
		add(namePanel, BorderLayout.NORTH);
		add(centerPanel, BorderLayout.CENTER);
		add(choicePanel, BorderLayout.SOUTH);
		setResizable(true);
		pack();
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);   
		setLocationRelativeTo(null);
		setVisible(true);
	}	

	
	/**
	 * Method to repaint the JFrame.
	 */
	@Override
	public void repaint()
	{
		super.repaint();
	}
}//End class LoginFrame.